#ifndef PERSISTENTDIALOG_H
#define PERSISTENTDIALOG_H

#include <QDialog>
#include <QMap>
#include <QDateTime>

#include "include/CardInfo.h"

class QShortcut;
class QTreeView;

class CardRenderer;
class TreeModel;

namespace Ui {
	class PersistentDialog;
}

class PersistentDialog : public QDialog
{
		Q_OBJECT

	public:
		explicit 							PersistentDialog(QWidget *parent =0);
		~PersistentDialog();
		void								show();

		const CardInfo&						cardInfo() const;
		void								setCardInfo(CardInfo value);

		QFont								documentFont() const;

	signals:

		void								answerDisplayed();

	public slots:

		void								reject();
		void								setDocumentFont(QFont font);

	protected:

		void								showEvent(QShowEvent *);

	private slots:

		void								knewIt();
		void								showAnswer();
		void								closeWithFail();

		void								startAnsweringTimer();

	private:

		void								displayCard(const CardInfo& info);
		void								registerTimeToAnswer();
		void								setDialogHeight(int height);

	private:

		Ui::PersistentDialog*				ui;
		CardInfo							m_cardInfo;
		QMap<QString, QShortcut*>			m_shortcuts;
		QDateTime							m_timeToAnswerStart;
		QFont								m_documentFont;
};

#endif // PERSISTENTDIALOG_H
